<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                xmlns:security="http://www.springframework.org/security/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">用户钱包提现明细</ui:define>
    <ui:define name="content">
        <h:form>
            <p:defaultCommand target="search"/>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="left">
                        <p:commandButton id="toggler" type="button" value="展示选择"
                                         style="width: auto;"
                                         icon="ui-icon-calculator"
                                         rendered="#{security:areAllGranted('LOAN_USER_WALLET_WITHDRAW_RECORD_SEARCH')}"/>
                        <p:columnToggler datasource="loanUserWalletDataTable" trigger="toggler"
                                         rendered="#{security:areAllGranted('LOAN_USER_WALLET_WITHDRAW_RECORD_SEARCH')}"/>
                    </f:facet>
                    <f:facet name="right">
                        <p:commandButton id="search" value="查询" icon="fa fa-search"
                                         update="@form"
                                         rendered="#{loanUserWalletWithdrawRecordBean.isNormal() and security:areAllGranted('LOAN_USER_WALLET_WITHDRAW_RECORD_SEARCH')}"/>
                         <p:commandButton value="导出" icon="fa fa-download"
                                         rendered="#{loanUserWalletWithdrawRecordBean.isNormal() and security:areAllGranted('LOAN_USER_WALLET_WITHDRAW_RECORD_EXPORT')}"
                                         ajax="false">
                            <p:dataExporter type="xls" target="loanUserWalletDataTable" fileName="export"/>
                        </p:commandButton>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="card">
                            <h1>查询条件</h1>
                            <p:panelGrid columns="8" layout="grid"
                                         columnClasses="ui-grid-col-1,ui-grid-col-2"
                                         styleClass="ui-panelgrid-blank"
                                         style="border:0px none; background-color:transparent;">
                                         
                                <p:outputLabel for="startDate" value="开始日期"/>
                                <p:calendar id="startDate" value="#{loanUserWalletWithdrawRecordBean.$.startDate}"
                                            locale="#{constants:get('LOCALE')}"
                                            timeZone="#{constants:get('TIME_ZONE')}"
                                            pattern="#{constants:get('DATE_FORMAT')}"/>
                                 
                                <p:outputLabel for="endDate" value="结束日期"/>
                                <p:calendar id="endDate" value="#{loanUserWalletWithdrawRecordBean.$.endDate}"
                                            locale="#{constants:get('LOCALE')}"
                                            timeZone="#{constants:get('TIME_ZONE')}"
                                            pattern="#{constants:get('DATE_FORMAT')}"/>
                                            
                                <p:outputLabel for="prdId" value="产品"/>
                                <p:selectOneMenu id="prdId" value="#{loanUserWalletWithdrawRecordBean.$.productId}"
                                				 filter="true" filterMatchMode="contains">
                                     <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                   	 <f:selectItems
                                            value="#{loanUserWalletWithdrawRecordBean.commProductIds}"
                                            var="product"
                                            itemLabel="#{product.name}" itemValue="#{product.productId}"/>
                                </p:selectOneMenu> 
                                
                                <p:outputLabel for="platform" value="平台"/>
                                <p:selectOneMenu id="platform" value="#{loanUserWalletWithdrawRecordBean.$.platform}">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                   	<f:selectItem itemLabel="安卓" itemValue="android" noSelectionOption="true"/>
                                   	<f:selectItem itemLabel="ios" itemValue="ios" noSelectionOption="true"/>
                                </p:selectOneMenu>
                                
                                <p:outputLabel for="channelCode" value="渠道"/>
                                <p:selectOneMenu id="channelCode" value="#{loanUserWalletWithdrawRecordBean.$.channelCode}"
                                				filter="true" filterMatchMode="contains">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                   	 <f:selectItems
                                            value="#{loanUserWalletWithdrawRecordBean.commProductChannels}"
                                            var="channel"
                                            itemLabel="#{channel.channelName}" itemValue="#{channel.channelCode}"/>
                                </p:selectOneMenu>
                                 
                                <p:outputLabel for="mobnum" value="手机号"/>
                   				<p:inputText id="mobnum" value="#{loanUserWalletWithdrawRecordBean.$.mobnum}" style="width:100%"/>
                   				
                   				<p:outputLabel for="withdrawType" value="提现通道"/>
                                <p:selectOneMenu id="withdrawType" value="#{loanUserWalletWithdrawRecordBean.$.withdrawType}">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                   	<f:selectItem itemLabel="支付宝转账" itemValue="1" noSelectionOption="true"/>
                                   	<f:selectItem itemLabel="微信红包" itemValue="2" noSelectionOption="true"/>
                                   	<f:selectItem itemLabel="话费充值" itemValue="3" noSelectionOption="true"/>
                                </p:selectOneMenu>
                   				
                   				<p:outputLabel for="status" value="发放状态"/>
                                <p:selectOneMenu id="status" value="#{loanUserWalletWithdrawRecordBean.$.status}">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                   	<f:selectItem itemLabel="待发放" itemValue="0" noSelectionOption="true"/>
                                   	<f:selectItem itemLabel="已发放" itemValue="1" noSelectionOption="true"/>
                                   	<f:selectItem itemLabel="发放失败" itemValue="-1" noSelectionOption="true"/>
                                   	<f:selectItem itemLabel="已领取" itemValue="2" noSelectionOption="true"/>
                                   	<f:selectItem itemLabel="已失效" itemValue="-2" noSelectionOption="true"/>
                                   	<f:selectItem itemLabel="已退款" itemValue="-3" noSelectionOption="true"/>
                                </p:selectOneMenu>
                                
                            </p:panelGrid>
                        </div>
                        <div class="card">
                            <p:dataTable id="loanUserWalletDataTable"
                                         style="width: 100%"
                                         var="record"
                                         value="#{loanUserWalletWithdrawRecordBean.lazyDataModel}"
                                         rows="#{constants:get('ROWS')}"
                                         lazy="true"
                                         paginator="true"
                                         paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                         rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                         emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                         scrollable="true"
                                         scrollWidth="97%"
                                         reflow="true"
                                         selection="#{loanUserWalletWithdrawRecordBean.selectedRecords}"
                                         resizableColumns="true"
                                         rendered="#{security:areAllGranted('LOAN_USER_WALLET_WITHDRAW_RECORD_SEARCH')}">

                                <p:column headerText="提现时间">
                                    <h:outputText value="#{record.createTime}">
                                        <f:convertDateTime pattern="#{constants:get('DATETIME_FORMAT')}"/>
                                    </h:outputText>
                                </p:column>
                                <p:column headerText="产品">
                                    <h:outputText value="#{loanUserWalletWithdrawRecordBean.translateProduct(record.productId)}"/>
                                </p:column>
                                <p:column headerText="渠道">
                                    <h:outputText value="#{loanUserWalletWithdrawRecordBean.translateProductChannel(record.channelCode)}"/>
                                </p:column>
                                <p:column headerText="平台">
                                    <h:outputText value="#{record.platform}"/>
                                </p:column>
                                <p:column headerText="用户手机号">
                                    <h:outputText value="#{record.mobnum}"/>
                                </p:column>
                                <p:column headerText="提现金额">
                                    <h:outputText value="#{record.amount}"/>
                                </p:column>
                                <p:column headerText="提现通道">
                                    <h:outputText value="#{loanUserWalletWithdrawRecordBean.translateWithdrawType(record.withdrawType)}"/>
                                </p:column>
                                <p:column headerText="提现账号">
                                    <h:outputText value="#{record.withdrawAccount}"/>
                                </p:column>
                                <p:column headerText="提现订单号">
                                    <h:outputText value="#{record.orderId}"/>
                                </p:column>
                                 <p:column headerText="发放状态">
                                    <h:outputText value="#{loanUserWalletWithdrawRecordBean.translateStatus(record.status)}"/>
                                </p:column>
                                 <p:column headerText="操作">
                                     <p:commandButton value="返回余额" icon="fa fa-retweet"
                                                     actionListener="#{loanUserWalletWithdrawRecordBean.returnBalance(record.id)}"
                                                     update="@form" process="@this"
                                                     rendered="#{record.returnBalance and security:areAllGranted('LOAN_USER_WALLET_WITHDRAW_RECORD_RETURN_BALANCE')}"/>
                                </p:column>
                                
                            </p:dataTable>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
